$(document).ready(function(){
  
}); 

button_query_onclick = function (){
	efgrid.submitInqu( "ef_grid_result", "ZM","ZMCS10","query");
}
button_update_onclick = function (){
	if (isLegal() == 0) {
        return;
    }  
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCS10","update",true);
}
button_insert_onclick = function (){
	if (isLegal() == 0) {
        return;
    }
	
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCS10","insert",true);
}
button_delete_onclick = function (){
	if (isSelected("ef_grid_result") == 0)return; 
	EFConfirm('你确认要删除吗?', '确认框', function(r) {
		efgrid.submitForm( "ef_grid_result", "ZM","ZMCS10","delete",true);
	});
}
/*
判断查询条件项是否合法
*/
function isLegal() {
	  var grid = efgrid.getGridObject("ef_grid_result");
	  var rows = grid.getCheckedRows();
	  if(rows.length<=0){
	  	  alert("请至少选择一条数据！");
	      return 0;
	  }
} 

efgrid_afterAddNewRow = function(grid_id) {
	var grid = efgrid.getGridObject(grid_id);
	var rows = grid.getCheckedRows();
	if (grid_id == "ef_grid_result") {
		for (var i = 0; i < rows.length; i++) {
			grid.getBlockData().setCell(rows[i], "fdKeyId", "");
		}
	}
}